/** layuiAdmin.std-v1.0.0 LPPL License By http://www.layui.com/admin/ */
;
layui.define(["table", "form"],
    function(e) {
        var t = layui.$,
            i = layui.table;
        layui.form;
        i.render({
            elem: "#LAY-user-manage",
            url: layui.setter.base + "json/useradmin/webuser.js",
            cols: [[{
                type: "checkbox",
                fixed: "left"
            },
                {
                    field: "id",
                    width: 100,
                    title: "ID",
                    sort: !0
                },
                {
                    field: "username",
                    title: "鐢ㄦ埛鍚�",
                    minWidth: 100
                },
                {
                    field: "avatar",
                    title: "澶村儚",
                    width: 100,
                    templet: "#imgTpl"
                },
                {
                    field: "phone",
                    title: "鎵嬫満"
                },
                {
                    field: "email",
                    title: "閭"
                },
                {
                    field: "sex",
                    width: 80,
                    title: "鎬у埆"
                },
                {
                    field: "ip",
                    title: "IP"
                },
                {
                    field: "jointime",
                    title: "鍔犲叆鏃堕棿",
                    sort: !0
                },
                {
                    title: "鎿嶄綔",
                    width: 150,
                    align: "center",
                    fixed: "right",
                    toolbar: "#table-useradmin-webuser"
                }]],
            page: !0,
            limit: 30,
            height: "full-220",
            text: "瀵逛笉璧凤紝鍔犺浇鍑虹幇寮傚父锛�"
        }),
            i.on("tool(LAY-user-manage)",
                function(e) {
                    e.data;
                    if ("del" === e.event) layer.prompt({
                            formType: 1,
                            title: "鏁忔劅鎿嶄綔锛岃楠岃瘉鍙ｄ护"
                        },
                        function(t, i) {
                            layer.close(i),
                                layer.confirm("鐪熺殑鍒犻櫎琛屼箞",
                                    function(t) {
                                        e.del(),
                                            layer.close(t)
                                    })
                        });
                    else if ("edit" === e.event) {
                        t(e.tr);
                        layer.open({
                            type: 2,
                            title: "缂栬緫鐢ㄦ埛",
                            content: "../../../views/user/user/userform.html",
                            maxmin: !0,
                            area: ["500px", "450px"],
                            btn: ["纭畾", "鍙栨秷"],
                            yes: function(e, t) {
                                var l = window["layui-layer-iframe" + e],
                                    r = "LAY-user-front-submit",
                                    n = t.find("iframe").contents().find("#" + r);
                                l.layui.form.on("submit(" + r + ")",
                                    function(t) {
                                        t.field;
                                        i.reload("LAY-user-front-submit"),
                                            layer.close(e)
                                    }),
                                    n.trigger("click")
                            },
                            success: function(e, t) {}
                        })
                    }
                }),
            i.render({
                elem: "#LAY-user-back-manage",
                url: layui.setter.base + "json/useradmin/mangadmin.js",
                cols: [[{
                    type: "checkbox",
                    fixed: "left"
                },
                    {
                        field: "id",
                        width: 80,
                        title: "ID",
                        sort: !0
                    },
                    {
                        field: "loginname",
                        title: "鐧诲綍鍚�"
                    },
                    {
                        field: "telphone",
                        title: "鎵嬫満"
                    },
                    {
                        field: "email",
                        title: "閭"
                    },
                    {
                        field: "role",
                        title: "瑙掕壊"
                    },
                    {
                        field: "jointime",
                        title: "鍔犲叆鏃堕棿",
                        sort: !0
                    },
                    {
                        field: "check",
                        title: "瀹℃牳鐘舵€�",
                        templet: "#buttonTpl",
                        minWidth: 80,
                        align: "center"
                    },
                    {
                        title: "鎿嶄綔",
                        width: 150,
                        align: "center",
                        fixed: "right",
                        toolbar: "#table-useradmin-admin"
                    }]],
                text: "瀵逛笉璧凤紝鍔犺浇鍑虹幇寮傚父锛�"
            }),
            i.on("tool(LAY-user-back-manage)",
                function(e) {
                    e.data;
                    if ("del" === e.event) layer.prompt({
                            formType: 1,
                            title: "鏁忔劅鎿嶄綔锛岃楠岃瘉鍙ｄ护"
                        },
                        function(t, i) {
                            layer.close(i),
                                layer.confirm("纭畾鍒犻櫎姝ょ鐞嗗憳锛�",
                                    function(t) {
                                        console.log(e),
                                            e.del(),
                                            layer.close(t)
                                    })
                        });
                    else if ("edit" === e.event) {
                        t(e.tr);
                        layer.open({
                            type: 2,
                            title: "缂栬緫绠＄悊鍛�",
                            content: "../../../views/user/administrators/adminform.html",
                            area: ["420px", "420px"],
                            btn: ["纭畾", "鍙栨秷"],
                            yes: function(e, t) {
                                var l = window["layui-layer-iframe" + e],
                                    r = "LAY-user-back-submit",
                                    n = t.find("iframe").contents().find("#" + r);
                                l.layui.form.on("submit(" + r + ")",
                                    function(t) {
                                        t.field;
                                        i.reload("LAY-user-front-submit"),
                                            layer.close(e)
                                    }),
                                    n.trigger("click")
                            },
                            success: function(e, t) {}
                        })
                    }
                }),
            i.render({
                elem: "#LAY-user-back-role",
                url: layui.setter.base + "json/useradmin/role.js",
                cols: [[{
                    type: "checkbox",
                    fixed: "left"
                },
                    {
                        field: "id",
                        width: 80,
                        title: "ID",
                        sort: !0
                    },
                    {
                        field: "rolename",
                        title: "瑙掕壊鍚�"
                    },
                    {
                        field: "limits",
                        title: "鎷ユ湁鏉冮檺"
                    },
                    {
                        field: "descr",
                        title: "鍏蜂綋鎻忚堪"
                    },
                    {
                        title: "鎿嶄綔",
                        width: 150,
                        align: "center",
                        fixed: "right",
                        toolbar: "#table-useradmin-admin"
                    }]],
                text: "瀵逛笉璧凤紝鍔犺浇鍑虹幇寮傚父锛�"
            }),
            i.on("tool(LAY-user-back-role)",
                function(e) {
                    e.data;
                    if ("del" === e.event) layer.confirm("纭畾鍒犻櫎姝よ鑹诧紵",
                        function(t) {
                            e.del(),
                                layer.close(t)
                        });
                    else if ("edit" === e.event) {
                        t(e.tr);
                        layer.open({
                            type: 2,
                            title: "缂栬緫瑙掕壊",
                            content: "../../../views/user/administrators/roleform.html",
                            area: ["500px", "480px"],
                            btn: ["纭畾", "鍙栨秷"],
                            yes: function(e, t) {
                                var l = window["layui-layer-iframe" + e],
                                    r = t.find("iframe").contents().find("#LAY-user-role-submit");
                                l.layui.form.on("submit(LAY-user-role-submit)",
                                    function(t) {
                                        t.field;
                                        i.reload("LAY-user-back-role"),
                                            layer.close(e)
                                    }),
                                    r.trigger("click")
                            },
                            success: function(e, t) {}
                        })
                    }
                }),
            e("useradmin", {})
    });